import React, { Component } from 'react';



import './App.css';
import  Nav from './common/nav';
import MyRoute from  './common/root';
import history from "./common/history";

class App extends Component {

    changeRoute = () =>{
        console.log('手动更改路由的时候，是否调用了')
        /******************************当前路由不在首页时，设置单签路由标签选中*****************************************************/
        let nowRoute =history.location.pathname
        if(nowRoute.length>1){//非首页
            nowRoute = nowRoute.substring(1,nowRoute.length);
        }else {//首页
            nowRoute='index'
        }
        this.refs.nav.setState({
            selectKey:[nowRoute]
        })
        /***********************************************************************************/

    }
    componentDidMount = () =>{

        this.changeRoute();



    }
    render() {
    return (
      <div className="">
          <Nav ref={'nav'}/>
          <MyRoute/>
      </div>
    );
  }
}

export default App;
